const initState = {
	nickname: '',
	permission_ids: '',
	token: ''
}


export default (state = initState, action: any) => {
	switch(action.type) {
		case 'loginSuccess': 
			return {
				...state,
				nickname: action.payload.nickname,
				permission_ids: action.payload.permission_ids,
				token: action.payload.token,
			};
		case 'loginFail': {
			return {
				nickname: '',
				permission_ids: '',
				token: ''
			}
		}
	}
	return state
}